﻿using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace XYS.Core.Util;

public static partial class Extention
{
    /// <summary>
    /// 13位时间戳转为 DateTime 
    /// </summary>
    /// <param name="timestamp"></param>
    /// <returns></returns>
    public static DateTime ToDateTime(this long timestamp)
    {
        DateTime unixEpoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        DateTime dateTime = unixEpoch.AddMilliseconds(timestamp);
        return dateTime.ToLocalTime(); // 转换为本地时间
    }

}